<?php
echo $javascript->link(array('autocomplete/jquery.tokeninput'));
echo $this->Html->css(array('autocomplete/token-input-facebook', 'autocomplete/token-input'));
?>
<!-----Print screen Javascript---->

<script language="javascript">
function Print()
{
	document.print.submit();
        document.getElementById('printbutton').style.display='none';
	window.print();
}

</script>
<!-- Print Screen Javascript ends--->

<?php echo $javascript->link(array('popup/jquery.fancybox-1.3.4.pack','popup/fancybox.impl'));
      echo $this->Html->css(array('jquery.fancybox-1.3.4'), 'stylesheet', array('media' => 'screen'));
?>

<table width="1024px">
    <tr ><td><div><div style="float: left"><div style="float: left">
            <?php 
            echo $this->Form->Create('Subject',array('action'=>'search'));
            echo $this->Form->input('search',array('label'=>'','value'=>'Search By subject or title','id'=>'autocomplete','class'=>'watermark','onclick'=>'this.value=""','AUTOCOMPLETE'=>'OFF'));?></div>
                    <div style="float: right;margin: 2px 0 0 164px;">
            <?php echo $this->Form->end(array('label'=>'Search','class'=>'mybutton'))?>
            <?php if($_SERVER['HTTP_HOST']=='localhost'){$url='/ratetheu/admin/Subjects/search_suggestion';}else{$url='search_suggestion';} ?>
                        <script type="text/javascript">
                            $(document).ready(function() {
                                $("#autocomplete").tokenInput("<?php echo $url; ?>", {
                                        theme: "facebook",
                                        tokenLimit: 1,
                                        preventDuplicates: true
                                    });
                                });
                            </script>
            </div></div><div  style="float:right">
            
            
     <?php echo $this->Html->link(
        $this->Html->image('../img/add_more.png', array('alt' =>'Add more')),array('action'=>'add'),
                array('escape' => false,'class'=>'noprint')
        ); ?></div></div></td></tr>
    <tr><td>&nbsp;</td></tr>
    <tr>
        <td>

            <table width="100%" id="table" >
                <tr >
                    <th width="30px"><?php echo $this->Paginator->sort('ID', 'id'); ?></th>
                    <th width="224px"><?php echo $this->Paginator->sort('Subject', 'subject'); ?></th>
                    <th width="250px"><?php echo "Adjectives"; ?></th>
                    <th width="250px"><?php echo "Tags"; ?></th>
                    <th width="150px"><?php echo "17 + ?"; ?></th>
                    <th width="40px">View</th>
                    <th width="40px">Edit</th>
                    <th width="40px">Delete</th>
                    
                </tr>
<?php foreach ($Subjects as $data): ?>
                    <tr id="table_content">
                        <td><?php echo $data['Subject']['id']; ?></td>
                        <td><?php if(!empty($data['Subject']['desc'])){$attribute="<span style='padding-left:6px;'>(". $data['Subject']['desc'].")</span>";}else{$attribute='';} echo $data['Subject']['subject'].$attribute ;?></td>
                        <td><?php echo $data['Subject']['adjective_ids']; ?></td>
                        <td><?php echo $data['Subject']['tag_ids']; ?></td>
                        <td><?php if($data['Subject']['17+']=='0'){ echo "No";}else{ echo "Yes";}?></td>
                        <td><?php echo $this->Html->link($this->Html->image('view.png', array('alt' => 'View','border'=>'0')), array('action' => 'admin_view', $data['Subject']['id']), array('escape' => false)); ?></td>
                            <td><?php echo $this->Html->link($this->Html->image('user_edit.png', array('alt' => 'Edit' ,'border'=>'0')), array('action' => 'admin_edit', $data['Subject']['id']), array('escape' => false)); ?></td>
                            <td><?php echo $this->Html->link($this->Html->image('trash.png', array('alt' => 'Delete' ,'border'=>'0')), array('action' => 'admin_delete', $data['Subject']['id']), array('escape' => false,'onclick'=>"return confirm('Are you sure you want to delete?')")); ?></td>
                    </tr>
                        <?php endforeach; ?>
                <tr><td><?php
                        echo $this->Paginator->numbers();
                        
                        ?></td></tr>
            </table>
        </td>
    </tr>
</table>
<!--- ***********************************   This will be used to print screen        *************************************/--->

<div style="margin-top:31px; margin-left:3px;">
    <form name="print" method="POST" action="">
        <input type="submit" id="printbutton" name="print" value="Print" style="width:60px; height:30px;" onclick="Print();" />
    </form>
</div>	
<!---************************************************************************/--->	


<script type="text/javascript">
		$(document).ready(function() {
			/*
			*   Examples - images
			*/

			
			$("a#example3").fancybox({
				'transitionIn'	: 'none',
				'transitionOut'	: 'none'	
			});
		});
                $(".watermark").click(function(){
                    $(this).removeClass()});
	</script>